<template xmlns:v-lazy="http://www.w3.org/1999/xhtml">
  <w-cell
    :icon="item.pcMeListCover"
    :title="item.name"
    :link="item.url"
    :describe="item.strtAndEndTime"
    :detail="item.describe"
    :operation="true"
    @cellClick="cellClick"
    @editClick="editBtnClick"
    @removeClick="okRemoveBtnClick"/>
</template>

<script>
import Config from '@/config/index'
import WCell from '@/components/pc/Cell/cell_01'
export default {
  name: 'AdminWebWorksCell',
  components: {
    WCell
  },
  props: {
    item: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  methods: {
    /**
     * 链接点击
     */
    linkClick() {
      if (this.item.url) {
        window.open(this.item.url)
      } else {
        this.cellClick()
      }
    },
    /**
     * cell 点击
     */
    cellClick() {
      window.open(`#/web/works/detail?id=${this.item._id}`)
    },
    /**
     * 编辑按钮点击
     */
    editBtnClick() {
      this.$router.push({ name: 'AdminWebWorksAdd', query: { id: this.item._id }})
    },
    /**
     * 删除确认
     */
    okRemoveBtnClick() {
      this.item.dustbin_push('name').then(() => {
        this.$emit('reload')
      }).catch(() => {})
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
